package com.edu.ahm.submit;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ThreadNew {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        new ThreadNew1().start();

        new Thread(new ThreadNew2()).start();

        FutureTask<Integer> futureTask = new FutureTask(new ThreadNew3());
        new Thread(futureTask).start();

        Integer integer = futureTask.get();

        System.out.println(integer);

    }

}

class ThreadNew1 extends Thread{
    @Override
    public void run() {
        System.out.println("ThreadNew1");
    }
}

class ThreadNew2 implements Runnable{
    @Override
    public void run() {
        System.out.println("ThreadNew2");
    }
}
class ThreadNew3 implements Callable<Integer>{

    @Override
    public Integer call() throws Exception {
        return 3;
    }
}